package labeling;

import java.util.ArrayList;
import java.util.List;

import data.DataBig;

public class LabelingBig {
	
	List<DataBig> data = new ArrayList<DataBig>();
	List<DataBig> pos = new ArrayList<DataBig>();
	List<DataBig> neg = new ArrayList<DataBig>();
	List<DataBig> neu = new ArrayList<DataBig>();
	
	public LabelingBig(List<DataBig> data, double avg, double[] ubias, double[] ibias){
		for(DataBig datum : data){
			int uid = datum.uid;
			int iid = datum.iid;
			double rat = datum.rat;
			
			double pred = avg + ubias[uid-1] + ibias[iid-1];
			
			if(rat - pred > 0){
				pos.add(datum);
				this.data.add(new DataBig(uid, iid, rat));
			}
			else {
				neg.add(datum);
				this.data.add(new DataBig(uid, iid, rat));
			}
		}
	}
	
	public LabelingBig(List<DataBig> data, double avg, double[] ubias, double[] ibias, double epsilon) {
		for(DataBig datum : data){
			int uid = datum.uid;
			int iid = datum.iid;
			double rat = datum.rat;
			
			double pred = avg + ubias[uid-1] + ibias[iid-1];
			
			if(rat - pred - epsilon > 0){
				pos.add(datum);
				this.data.add(new DataBig(uid, iid, rat));
			}
			else if (rat - pred + epsilon < 0){
				neg.add(datum);
				this.data.add(new DataBig(uid, iid, rat));
			}
			else {
				neu.add(datum);				
				this.data.add(new DataBig(uid, iid, rat));
			}
		}
	}

	public List<DataBig> getPos() {
		return pos;
	}

	public List<DataBig> getNeg() {
		return neg;
	}

	public List<DataBig> getNeu() {
		return neu;
	}

	public List<DataBig> getData() {
		// TODO Auto-generated method stub
		return data;
	}

}
